package com.sy.service.account.impl;

import com.sy.bean.account.Account;
import com.sy.bean.account.HomeMoney;
import com.sy.common.crud.BaseServiceImpl;
import com.sy.common.exception.BusinessException;
import com.sy.mapper.account.AccountMapper;
import com.sy.service.account.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AccountServiceImpl extends BaseServiceImpl<Account, AccountMapper> implements AccountService{
    @Autowired
    AccountMapper accountMapper;

    @Override
    public int save(Account entity) {
        String code = accountMapper.queryMaxCode();
        if (code!=null|| code.equals(""))
            entity.setCode("1001");
        int num = Integer.parseInt(code);
        num++;
        entity.setCode(String.valueOf(num));
        return super.save(entity);
    }

    @Override
    public int updateAcc(Account account) {
        return baseMapper.updateAcc(account);
    }

    @Override
    public int delAcc(int id) {
        return baseMapper.delAcc(id);
    }

    @Override
    public HomeMoney queryHomeMoney(int eid) {
        return baseMapper.queryHomeMoney(eid);
    }
}
